package com.study.model;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

@Component
/**
 * 意思是从yml中的prefix对象中拿属性,注意看yml的对象一般都写在行首,所以prefix你懂的,一般配合@Component使用!!!
 * 这个注解,会将yml配置文件中属性名一样的值注入到User类对应的字段中, 相当于给每个字段加上@Value
 * https://blog.csdn.net/zzzgd_666/article/details/80316174?utm_medium=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.nonecase
 */
//@ConfigurationProperties(prefix = "person")
//从Xxx.properties中,配合SPEL,@Value("#{11*2}")知识和@Value("${person.name}"),还是麻烦,
//@PropertySource(value = {"classpath:Xxx.properties"})
// spring旧的知识,导入其他xml,other.xml中的bean会加入spring容器中,springBoot推荐用@Configuration加全注解,
//@ImportResource("classpath:other.xml")
//jsr303,校验相关,
@Validated
@Data
@NoArgsConstructor
public class Person {
	//手写麻烦,用@ConfigurationProperties代替
//	@Value("${person.hyj}")
	private String name;
	//    @Value("3")
	private int age;
}
